Array.prototype.myEvery = function (test) {
  if (!Array.isArray(this)) throw new Error("must be called by array");
  const _stack = [...this];
  if (_stack.length === 0) return false;
  while (_stack.length) {
    const _value = _stack.pop();
    if (!test(_value, _stack.length - 1, _stack)) return false;
  }
  return true;
};

// eg
let arr = [];

let res = arr.myEvery((item, i) => {
  console.log("[ item ] >", item, i);
  return item >= 1;
});
console.log(" [ res ]-25", res);
// 比较
let res1 = arr.every((item, i) => {
  console.log("[some- item ] >", item, i);
  return item >= 1;
});
console.log(" [ res ]-25", res1);
